/*******************************************************************
//  File : des.h  
//   
//   
//  Date : 04/11/2011
//  Author : Brain 
********************************************************************/

#include <stdio.h>
#include <stdlib.h>
#define EN0     0
#define DE1     1

typedef struct {
        unsigned long ek[32];
        unsigned long dk[32];
} des_ctx;

extern void deskey(unsigned char *, short);

extern void usekey(unsigned long *);
extern void cpkey(unsigned long *);
extern void des(unsigned char *, unsigned char *);

static void scrunch(unsigned char *, unsigned long *);
static void unscrun(unsigned long *, unsigned char *);
static void desfunc(unsigned long *, unsigned long *);
static void cookey(unsigned long *);

void des_key(des_ctx *dc, unsigned char *key);
void des_enc(des_ctx *dc, unsigned char *data, int blocks);
void des_dec(des_ctx *dc, unsigned char *data, int blocks);

